﻿using System;

namespace SumFraction2
{
    class Program
    {
        static void Main(string[] args)
        {
            double PI, s = 0, x;

            double n = 1;

            do

            {
                x = Math.Pow(-1, n + 1) / (2 * n - 1);

                s = s + x;

                n++;

            } while (1 / n >= 0.000001);

            PI = s * 4;

            Console.WriteLine("PI的值为：{0}", PI);
            Console.ReadKey();
        }
        
    }
}
